Telegram Group & Telegram Channel
السلام عليكم
اعتذر على عدم إكمال بقية المواضيع بالأمس وذلك بسبب انقطاع الشبكة 😄
اليوم سنقوم بشرح الموضوع الثاني لنبدأ.
كيف تضيف خاصية جديدة او ميزة الى أداة من الأدوات
طبعاً الميزة او الخاصية الجديدة التي تريد ان تضيفها الى أداة تعتمد على تفكيرك فمثلاً
انا خطرت فكرة اني اعمل ميزة للازرار التي في الفورم ميزة انو عندما يكون مؤشر الماوس فوق الزر تتغير الايقونة وعندما يغادر مؤشر الماوس من الزر تعود الايقونة الى الايقونة السابقة
لنفرض ان معك في الفورم 4 او 5 او حتى 10 ازرار فإنك حتماً ستحتاج لكل زر دالتين دالة للحدث MouseHover ودالة للحدث mouseLeave
كود :
public Form5()
{
InitializeComponent();

}

private void button2_MouseHover(object sender, EventArgs e)
{
button2.Image = Image.FromFile(@"C:\Users\HASSAN_2\Desktop\Icon\eee.png");
}

private void button2_MouseLeave(object sender, EventArgs e)
{
button2.Image = Image.FromFile(@"C:\Users\HASSAN_2\Desktop\Icon\bb.png");
}

هل لاحظت المثال السابق سوف تقوم بتكرار نفس العملية لجميع الازرار
طريقة مملة صحيح اذاً لنبدأ بالطريقة الاحترافية
الأمثلة السابقة فقط لتوضيح الفكرة
كيف تعمل الطريقة الاحترافية
الفكرة هي انك تقوم بعمل كلاس وتقوم بالوراثة من الكلاس Button
ثم تقوم بتعريف متغيرين من نوع Image ولكل متغير خاصية get و set
ثم تقوم بإستنساخ الدوال الوهمية التالية
OnMouseHover
OnMouseLeave
ملاحظة لمن لايعرف ماذا يعني دالة ناسخة override او وهمية virtual يراجع معلوماته في الأساسيات (البرمجة الشيئية)
الكود كامل :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Drawing;
namespace Resize_Form
{
class CustomButton:Button
{
Image normalImage;
Image hoverImage;

public Image NormalImage
{
get
{
return normalImage;
}

set
{
normalImage = value;
Image = normalImage;
}
}

public Image HoverImage
{
get
{
return hoverImage;
}

set
{
hoverImage = value;
}
}
protected override void OnMouseHover(EventArgs e)
{
Image = hoverImage;
base.OnMouseHover(e);
}

protected override void OnMouseLeave(EventArgs e)
{
Image = normalImage;
base.OnMouseLeave(e);
}
}
}



tg-me.com/CsharpWindowsForm/374
Create:
Last Update:

السلام عليكم
اعتذر على عدم إكمال بقية المواضيع بالأمس وذلك بسبب انقطاع الشبكة 😄
اليوم سنقوم بشرح الموضوع الثاني لنبدأ.
كيف تضيف خاصية جديدة او ميزة الى أداة من الأدوات
طبعاً الميزة او الخاصية الجديدة التي تريد ان تضيفها الى أداة تعتمد على تفكيرك فمثلاً
انا خطرت فكرة اني اعمل ميزة للازرار التي في الفورم ميزة انو عندما يكون مؤشر الماوس فوق الزر تتغير الايقونة وعندما يغادر مؤشر الماوس من الزر تعود الايقونة الى الايقونة السابقة
لنفرض ان معك في الفورم 4 او 5 او حتى 10 ازرار فإنك حتماً ستحتاج لكل زر دالتين دالة للحدث MouseHover ودالة للحدث mouseLeave
كود :
public Form5()
{
InitializeComponent();

}

private void button2_MouseHover(object sender, EventArgs e)
{
button2.Image = Image.FromFile(@"C:\Users\HASSAN_2\Desktop\Icon\eee.png");
}

private void button2_MouseLeave(object sender, EventArgs e)
{
button2.Image = Image.FromFile(@"C:\Users\HASSAN_2\Desktop\Icon\bb.png");
}

هل لاحظت المثال السابق سوف تقوم بتكرار نفس العملية لجميع الازرار
طريقة مملة صحيح اذاً لنبدأ بالطريقة الاحترافية
الأمثلة السابقة فقط لتوضيح الفكرة
كيف تعمل الطريقة الاحترافية
الفكرة هي انك تقوم بعمل كلاس وتقوم بالوراثة من الكلاس Button
ثم تقوم بتعريف متغيرين من نوع Image ولكل متغير خاصية get و set
ثم تقوم بإستنساخ الدوال الوهمية التالية
OnMouseHover
OnMouseLeave
ملاحظة لمن لايعرف ماذا يعني دالة ناسخة override او وهمية virtual يراجع معلوماته في الأساسيات (البرمجة الشيئية)
الكود كامل :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Drawing;
namespace Resize_Form
{
class CustomButton:Button
{
Image normalImage;
Image hoverImage;

public Image NormalImage
{
get
{
return normalImage;
}

set
{
normalImage = value;
Image = normalImage;
}
}

public Image HoverImage
{
get
{
return hoverImage;
}

set
{
hoverImage = value;
}
}
protected override void OnMouseHover(EventArgs e)
{
Image = hoverImage;
base.OnMouseHover(e);
}

protected override void OnMouseLeave(EventArgs e)
{
Image = normalImage;
base.OnMouseLeave(e);
}
}
}

BY برمجة تطبيقات الويندوز C# Programming


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/CsharpWindowsForm/374

View MORE
Open in Telegram


برمجة تطبيقات الويندوز C Programming Telegram | DID YOU KNOW?

Date: |

Look for Channels Online

You guessed it – the internet is your friend. A good place to start looking for Telegram channels is Reddit. This is one of the biggest sites on the internet, with millions of communities, including those from Telegram.Then, you can search one of the many dedicated websites for Telegram channel searching. One of them is telegram-group.com. This website has many categories and a really simple user interface. Another great site is telegram channels.me. It has even more channels than the previous one, and an even better user experience.These are just some of the many available websites. You can look them up online if you’re not satisfied with these two. All of these sites list only public channels. If you want to join a private channel, you’ll have to ask one of its members to invite you.

To pay the bills, Mr. Durov is issuing investors $1 billion to $1.5 billion of company debt, with the promise of discounted equity if the company eventually goes public, the people briefed on the plans said. He has also announced plans to start selling ads in public Telegram channels as soon as later this year, as well as offering other premium services for businesses and users.

برمجة تطبيقات الويندوز C Programming from jp


Telegram برمجة تطبيقات الويندوز C# Programming
FROM USA